<!DOCTYPE html>
<html lang="ch-cn" xmlns:th="http://www.thymeleaf.org">
<head th:replace="layouts::header"></head>
<body>

    <nav th:replace="layouts::navbar"></nav>

<!--HTML模板中的student对象是从是从控制层来的，所以我们在控制层中，在displaystudentForm方法中传入Model对象。-->
<!--Spring框架的Model对象用于在控制层和视图层之间交换数据。-->
    <div class="container">
        <form action="/students/save" th:object="${student}" method="POST">
            <input type="hidden" th:href="${student.studentId}">
            <div class="form-group">
                <div class="col-sm-6">
                    <input class="form-control"
                           type="text" placeholder="name"
                           th:field="${student.name}">
                    <span
                            th:if="${#fields.hasErrors('name')}"
                            th:errors="${student.name}"
                    ></span>

                </div>
            </div>
            <br>
            <div class="form-group">
                <div class="col-sm-6">
                    <input class="form-control"
                           type="text" placeholder="wechatId"
                           th:field="${student.wechatId}">
                    <span
                            th:if="${#fields.hasErrors('wechatId')}"
                            th:errors="${student.wechatId}"
                    ></span>
                </div>
            </div>
            <br>
            <div class="form-group">
                <div class="col-sm-6">
                    <input class="form-control"
                           type="text" placeholder="email"
                           th:field="${student.email}">
                    <span
                            th:if="${#fields.hasErrors('email')}"
                            th:errors="${student.email}"
                    ></span>
                </div>
            </div>
            <br>
            <button type="submit" class="btn btn-info">新生</button>
        </form>
    </div>
</body>
</html>